/*
* Copyright (C) 2024-2025 Uniontech Technology Co., Ltd.
*
* Author:      zhangbingyi <zhangbingyi@uniontech.com>
*
* Maintainer:  zhangbingyi <zhangbingyi@uniontech.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef SCANWHITELIST_H
#define SCANWHITELIST_H

#include "widgets/defendertable.h"

#include <QDialog>
#include <QPushButton>
#include <QCommandLinkButton>
#include <QLabel>
//#include <DTipLabel>
//#include <DSuggestButton>
//#include <DBlurEffectWidget>

#include <QWidget>

using namespace def::widgets;

class DBusInvokerInterface;

class ScanWhiteList : public QFrame
{
    Q_OBJECT

public:
    explicit ScanWhiteList(QWidget *parent = nullptr);
    ~ScanWhiteList();

    // 初始化界面
    void initUI();
    // 初始化数据
    void initDate();

    // 初始化中间tableview布局
    QHBoxLayout *initTableWidget();

    // 过滤白名单路径
    void filterScanWhitePath(const QString &sPath);
    // 加载白名单目录数据
    void loadWhiteListData(QString sPath);

    // 添加文件弹窗
    Q_SLOT void showAddFile();

public Q_SLOTS:
    // 删除白名单
    void deleteFile();
    void deleteWhiteFile(const QString &sPath);
    // 接受确认按钮槽
    void acceptConfirmButtonClicked();

    void onSortIndicatorChanged(int logicalIndex, Qt::SortOrder order);
private:
//    DBlurEffectWidget *m_blurEffect; // 透明背景
    QCommandLinkButton *m_pAddFileBtn; // 添加文件
    QPushButton *m_pCancelBtn; // 取消按钮
    QPushButton *m_pConfirmBtn; // 确认按钮
    QLabel *m_whiteListTip; // 提示
    QFrame *m_line; // 分割线
    QTableView *m_tableView; // 表格
    QStandardItemModel *m_model; // QT表格模型
    DefenderTable *m_tableWidget; // 表格控件
    QLabel *m_garbageIcon; // 清理图标

    DBusInvokerInterface *m_monitorNetFlowInvokerInter; // 系统服务
    DBusInvokerInterface *m_deamonServiceInovokerInter; // 心跳服务

    QStringList m_sScanWhiteList;
    QStringList m_sTemScanWhiteList;
};

#endif // SCANWHITELIST_H
